#include <bits/stdc++.h>
using namespace std;
int n,q,l,r;
const int N=1e6+50;
int a[N],p[N];
int main(void){
    while(~scanf("%d%d",&n,&q)){
        memset(a,0,sizeof(a));
        memset(p,0,sizeof(p));
        for(int i=1;i<=n;i++){
            scanf("%d",&a[i]);
            p[i]=p[i-1]^a[i];
        }
        while(q--){
            scanf("%d%d",&l,&r);
            printf("%d\n",p[n]^(p[r]^p[l-1]));
        }
    }
    return 0;
}